Skip to content

deprecates exprt::move_to_operands(...) #3073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2018

Conversation

kroening
Copy link
Member

@kroening kroening commented Oct 1, 2018

Since sharing has been introduced there is no measureable performance
benefit when using move_to_operands compared to copying. Moving has the
disadvantage that there is a side-effect on the object that is moved.

  • Each commit message has a non-empty body, explaining why the change was made.
  • My contribution is formatted in line with CODING_STANDARD.md.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, a bit of a silly request-for-changes: could you please copy your analysis details from the other PR into the commit message? I think it's worth preserving that for the future, and it will be rather hard to find as this is across different PRs. Thank you!!!

@tautschnig tautschnig assigned kroening and unassigned tautschnig Oct 1, 2018
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passed Diffblue compatibility checks (cbmc commit: d9d3428).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86459004

Since sharing has been introduced there is no measureable performance
benefit when using move_to_operands compared to copying:

  for(int i=0; i<2000000; i++)
  {
    irep_idt id;
    symbol_exprt s(id, bool_typet());
    exprt something;
    something.move_to_operands(s);
    //something.copy_to_operands(s);
  }

with move_to_operands: 0.59s
with copy_to_operands: 0.55s

This does not appear to require a recent compiler.  Thus, there is no reason
to believe that moving ireps would be any faster than copying.  Moving has
the additional disadvantage that there is a side-effect on the object that
is moved.

A scenario in which moving offers a benefit is the idiom in which

1) an irep x is copied,
2) the copy is then subsequently modified,
3) x is then destroyed.

The proposal is to do step 1) via an rvalue reference and std::move()
instead.
@kroening kroening force-pushed the deprecate_move_to_operands branch from d9d3428 to 6f4274d Compare October 6, 2018 09:19
@kroening
Copy link
Member Author

kroening commented Oct 6, 2018

@tautschnig Done.

@kroening kroening assigned tautschnig and unassigned kroening Oct 6, 2018
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passed Diffblue compatibility checks (cbmc commit: 6f4274d).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/87094284

@tautschnig tautschnig merged commit ec8b34d into develop Oct 6, 2018
@tautschnig tautschnig deleted the deprecate_move_to_operands branch October 6, 2018 13:11
@smowton
Copy link
Contributor

smowton commented Oct 6, 2018

Given the discussion in the code_blockt::add / move PR, quite surprised this got merged. There is only no performance difference when using copy doesn't cause any extra CoW breaks; would prefer to revert this and use move judiciously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants